<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<%
dim aa, bb,cc
aa=Request.ServerVariables("LOGON_USER")
cc=Request.Querystring("AN")
if instr(1,aa, cc,1)=0 THEN
''response.clear
''response.end
end if

aa=Request.ServerVariables("HTTP_USER_AGENT")
bb="Indy"
if instr(1,aa, bb,1)=0  THEN
''response.clear
''response.end
end if
%>
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->
<%
dim Node, Sum, CN, DTA, Ph, Ma, ChargeOFF, text, cert, ph2, sign, date,bs, ext, deliverySum
Node=request("Node")
if isEmpty(Node) then Node="_P"
Sum=request("Sum")
if isEmpty(Sum) then Sum="0"
ChargeOFF=request("ChargeOFF")
if isEmpty(ChargeOFF) then ChargeOFF="0"
Ma=request("Ma")
if isEmpty(Ma) then Ma="0"
DeliverySum=request("DS")
if isEmpty(DeliverySum) then DeliverySum="0"
CN=request("CN")
if isEmpty(CN) then CN=""
text=request("text")
if isEmpty(text) then text=""
ext=request("ext")
if isEmpty(ext) then ext=""
sign=request("sign")
if isEmpty(sign) then sign=""
cert=request("cert")
if isEmpty(cert) then cert=""
DTA=request("DTA")
if isEmpty(DTA) then DTA=""
Ph=request("Ph")
if isEmpty(Ph) then Ph=""
Ph2=request("Ph2")
if isEmpty(Ph2) then Ph2=""
BS=request("BS")
if isEmpty(BS) then BS=0
Date=request("Date")
if isEmpty(Date) then Date=""

	Dim cnn
	Dim connStr
	dim cmd
	dim R
	Set cnn=Server.CreateObject("ADODB.Connection")
    Set cmd=Server.CreateObject("ADODB.Command")
%>
<!-- #INCLUDE FILE="Connection.inc" -->
<%
''''	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=EM-HOME"
	cnn.open connStr
	Set cmd.ActiveConnection = cnn
	cmd.CommandType=adCmdStoredProc
	cmd.CommandText = "sp_AutomatCertificate"

	Cmd.Parameters.Append Cmd.CreateParameter("@AutomatNumber", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@Phone", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Phone2", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Sum", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@Margin", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@ChargeOFF", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@DeliverySum", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@Code", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@DEMOPayment", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@CN", adVarChar, adParamInput,160)
	Cmd.Parameters.Append Cmd.CreateParameter("@Text", adVarChar, adParamInput,200)
	Cmd.Parameters.Append Cmd.CreateParameter("@Cert", adVarChar, adParamInput,500)
	Cmd.Parameters.Append Cmd.CreateParameter("@Sign", adVarChar, adParamInput,50)
	Cmd.Parameters.Append Cmd.CreateParameter("@Ext", adVarChar, adParamInput,32)
	Cmd.Parameters.Append Cmd.CreateParameter("@DTA", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Date", adVarChar, adParamInput,5)
	Cmd.Parameters.Append Cmd.CreateParameter("@BS", adDouble, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@id", adInteger, adParamOutput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Res", adInteger, adParamOutput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Result", adVarChar, adParamOutput,160)
	Cmd("@AutomatNumber")=Request.Querystring("AN")
	Cmd("@Phone")=Ph
	Cmd("@Phone2")=Ph2
	Cmd("@Sum")=Sum
	Cmd("@Margin")=Ma
	Cmd("@ChargeOFF")=ChargeOFF
	Cmd("@DeliverySum")=DeliverySum
	Cmd("@Code")=Request.Querystring("Cd")
	Cmd("@DEMOPayment")=Request.Querystring("De")
	Cmd("@CN")=CN
	Cmd("@Text")=Text
	Cmd("@Cert")=Cert
	Cmd("@Sign")=Sign
	Cmd("@Ext")=Ext
	Cmd("@DTA")=DTA
	Cmd("@Date")=Date
	Cmd("@BS")=BS
	cmd.execute
	%>
<Result>
<%=Cmd("@Result")%>
</Result>
<%
	set cmd=nothing
	cnn.close
	set cnn=nothing
%>
